<template>
  <view class="release">
    <view class="typeBox">
      <view @click="toRelease(item,index)" v-for="(item,index) in list" :key="index" class="part flex-center-center">
        <image :src=item.icon mode=""></image>
        <text class="word">{{item.name}}</text>
      </view>
    </view>
    <image @click="$emit('popStatus')" src="/static/images/tabbar/cancel.png" class="cancel"></image>
    <view :style="'height:'+safeAreaBottom+'px'">

    </view>
  </view>
</template>

<script>
import {
  institution_vipyqList,
  manufacturer_vipyqList,
  normalyqList
} from '@/const/index.js';

export default {
  data() {
    return {
      safeAreaBottom: uni.getStorageSync('safeAreaBottom'),
      list: []
    }

  },
  mounted() {
    let that = this
    that.$nextTick(() => {
      //机构 求货 //制造商 求货代加工
      if (uni.getStorageSync('userinfo').institution_vip != 1 && uni.getStorageSync('userinfo')
        .manufacturer_vip != 1) {
        that.list = normalyqList
      } else if (uni.getStorageSync('userinfo').institution_vip == 1 && uni.getStorageSync('userinfo')
        .manufacturer_vip != 1) {
        that.list = institution_vipyqList
      } else if (uni.getStorageSync('userinfo').institution_vip != 1 && uni.getStorageSync('userinfo')
        .manufacturer_vip == 1) {
        //拥有所有权限
        that.list = manufacturer_vipyqList
      } else if (uni.getStorageSync('userinfo').institution_vip == 1 && uni.getStorageSync('userinfo')
        .manufacturer_vip == 1) {
        //拥有所有权限
        that.list = manufacturer_vipyqList
      }
    })
  },
  methods: {
    toRelease(item, index) {
      this.$emit('popStatus');
      let url = '';
      switch (index) {
        case 0:
          url = '/pages/release/communicationCircle';
          break;
        case 1:
          url = '/pages/release/secondHand';
          break;
        case 2:
          url = '/pages/release/askingGoods';

          break;
        case 3:
          url = '/pages/release/processing';
          break;
      }
      uni.navigateTo({
        url,
      })
    }
  }
}
</script>

<style lang="scss" scopen>
.release {
  position: fixed;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  z-index: 9999;

  &::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(18px);
  }

  .typeBox {
    width: 100%;
    padding: 032rpx;
    box-sizing: border-box;
    height: 168rpx;
    display: flex;
    align-items: center;
    justify-content: space-around;

    .part {
      flex-direction: column;
    }

    image {
      width: 112rpx;
      height: 112rpx;
    }

    .word {
      font-size: 28rpx;
      font-family: PingFang SC-Medium, PingFang SC;
      font-weight: 500;
      color: #666666;
      margin-top: 16rpx;
      z-index: 9999;
    }
  }

  .cancel {
    width: 96rpx;
    height: 96rpx;
    margin-top: 100rpx;
  }
}
</style>